import { get, post, upload } from "./http";
//登录注册找回密码
export const getImgCaptcha = () => get("api/captcha");
export const loginUser = params => post("api/auth/login", params);
export const phonelogin = params => post("api/auth/smslogin", params);
export const getPhoneCaptcha = params => post("api/auth/verify", params);
export const checkVerify = params => post("api/check/verify", params);
export const setpwd = params => post("api/setpwd", params);
export const Register = params => post("api/register", params);
export const getWxLogin = () => get("api/wxlogin/img");
export const getEmail = params => get("api/verify/email", params);

//产品
export const getProductsCategory = params => get("api/packing/category", params);
export const getProductsList = params => post("api/packing/goods/lst", params);
export const getProductsTui = params => get("packing/goods/tui/" + params);
export const getProductsDe = params => get("api/store/product/detail/" + params);
export const getRecommend = params => get("api/store/product/similar/" + params.id, params);
export const getGuess = params => get("api/store/product/like/" + params.id, params);
export const collectPro = params => post("api/user/relation/create", params);
export const tuijianFuwu = params => get("api/store/product/fuwu/" + params);

//购物车
export const addCart = params => post("api/user/cart/create", params);
export const myCart = params => get("api/user/cart/lst", params);
export const delCart = params => post("api/user/cart/delete", params);
export const updateCart = params => post("api/user/cart/change/" + params.id, params);
export const clearCart = () => get("api/user/cart/clear");

//订单
export const previewOrder = params => post("api/l/order/check", params);
export const createOrder = params => post("api/l/order/create", params);

//个人中心-我的订单
export const myOrderDetail = params => get('api/order/group_order_detail/' + params)
export const myOrder = params => get("api/l/order/list", params);
export const myOrderNopay = params => get("api/l/order/nopaid", params);
export const myOrderPayment = params => get("api/order/status/" + params);
export const myOrderDe = params => get("api/order/detail/" + params);
export const myOrderPayForm = params => post("api/l/order/pay/of", params);
export const receiptOrder = params => post("api/order/take/" + params.id, params);
export const sureOrder = params => post("api/order/take/" + params.id, params);
export const cancelOrder = params => post("api/order/cancel/" + params.id, params);
export const unlinePayOrder = params => post("api/order/verify_order", params);
export const linePayOrder = params => post("api/order/order_pay", params);
export const replyOrder = params => post("api/reply", params);

//商家入驻申请
export const replyMerchant = params => post("api/intention/create", params);

//询价
export const getMerchantPros = params => get("api/inquiry/getmer", params);
export const pubInquiry = params => post("api/inquiry/add", params);

//个人中心-我的询价
export const getMyInquiry = params => get("api/inquiry/mylst/" + params.page + "/" + params.limit, params);
export const MyInquiryDe = params => get("api/inquiry/det/" + params);
export const postReply = params => post("api/inquiry/talka", params);

//上传
export const uploadPic = params => upload("api/upload/image/field", params);
export const uploadFile = params => upload("api/upload/file/field", params);

//发布需求
export const requirementPub = params => post("api/demand/release", params);
export const requirementDe = params => get("api/demand/details/" + params);
export const requirementUp = params => post("api/demand/update/" + params.id, params);
export const requireShops = params => get(`api/demand/getmer/lst?page=${params.page}&mer_name=${params.mer_name}`); // 选择其他商家
export const requireRange = () => get("api/demand/rance"); // 换一批
export const requireReplace = params => post(`api/demand/echo`, params);

//需求中心
export const getDemandsList = params => get("api/demand/list/" + params.page + "/" + params.limit, params.data);

//个人中心-我的需求
export const getMyDemands = params => get("api/demand/my/list/" + params.page + "/" + params.limit, params.data);
export const pubMyDemands = params => post("api/demand/status", params);
export const delMyDemands = params => get("api/demand/delete/" + params);
export const apiContentDem = params => get("api/demand/mer_content/" + params); // 商家推荐商品
export const apiDemandMessage = params => post("api/demand/message", params); // 回复消息
/** 我的需求-详情-商家回复详情 */
export const demandMerInfo = (params) => get(`api/demand/detail/${params.uid}/${params.id}`)
/** 我的需求-详情-回复列表和商家推荐 */
export const demandMerList = (params) => get(`api/demand/content/${params.uid}/${params.id}`)
/**我的委托-详情-回复列表 */
export const entrustList = (params) => get(`api/demand/contentlist/${params.id}/1`)
/** 获取用户电话或邮箱
 * @param type phone or email
 */
export const userPhoneOrEmail = (type) => post(`api/demand/send/${type}`)
/** 取消发布需求 
 * @param id 需求ID
*/
export const cancelDemandApi = (id,params) => post(`api/demand/addCancel/${id}`,params)
/** 取消问题列表 */
export const cancelNameList = () => get('api/demand/cancellist')

//展览会议
export const joinExhibition = params => get("api/exhibition/record", params);
export const getExhibitionCate = () => get("api/exhibition/category/lst/0");
export const getExhibitionList = params => get("api/exhibition/lst/" + params.cid, params);
export const getExhibitionDe = params => get("api/exhibition/detail/" + params);

//提交建议
export const postSuggestion = params => post("api/store/proposal/feedback", params);

//提交订阅
export const postSubscribe = params => post("api/email/sub", params);

//新闻
export const getNewsCategory = () => get("api/article/category/lst/0");
export const getNewsList = params => get(`api/article/lst/${params.cid}`, params);
export const getNewsDetail = params => get("api/article/detail/" + params);

//入驻企业
export const inviteMerchant = params => post("api/mer/inv/" + params.id, params);
export const getMerchantList = params => get("api/mer/lst", params);
export const getMerchantHome = params => get("api/store/merchant/home/" + params);
export const getMerchantDe = params => get("api/store/merchant/details/" + params);
export const getMerchantCate = params => get("api/store/merchant/category/lst/" + params);
export const getMerchantProList = (id,params) => get(`api/store/merchant/product/lst/${id}`, params);

// 收藏
export const getCollection = params => post("api/user/relation/create", params);

//入驻企业-公司介绍
export const getMerchantIntro = params => get("api/store/merchant/about/lst/" + params);
export const enterprise_cateApi = () => get('api/store/merchant/enterprise_cate'); //商家入驻资质认证分类列表

//入驻企业-packmate
export const getMerchantMate = params => get("api/store/merchant/packmate/lst/" + params);

//入驻企业-新闻
export const getNewsCategoryMer = params => get(`api/store/merchant/article/category/lst/${params}/0`);
export const getNewsListMer = params => get(`api/store/merchant/article/lst/${params.mer_id}/${params.cid}`, params);
export const getNewsDeMer = params => get(`api/store/merchant/article/detail/${params.id}`, params);

//入驻企业-联系我们
export const postMessageMer = params => post("api/store/proposal/feedback", params);
export const contactInfoMer = params => get("api/store/merchant/detail/" + params);

//入驻企业-常见问题
export const questionsListMer = params => get("api/store/merchant/problem/lst/" + params.id, params);

//首页
export const getHome = () => get("api/common/home");
export const apiCheckBind = () => get("api/user/check_binding_info"); // 用户绑定信息
export const apiwxLogin = data => get(`api/wxlogin`, data);

//用户声音
export const getUserVoice = () => get("api/voice/lst");

//帮助中心
export const helpSearch = params => get("api/help/search/" + params);
export const getCategory2 = params => get("api/help/category/cate/" + params);
export const getHelpHot = () => get("api/help/hot");
export const getHelpList = params => get("api/help/lst/" + params.cid, params);
export const getHelpDe = params => get("api/help/detail/" + params);

//我的收藏
export const getCollectPro = params => get("api/user/relation/product/lst", params);
export const getCollectStore = params => get("api/user/relation/merchant/lst", params);

//个人中心-会员权益
export const getMyVip = () => get('api/user/equity/vip') // 我的会员
export const getVip = () => get('api/vip/lst') // 会员列表
export const getuserEquitylst = () => get('api/user/equity/lst') // 我的权益
export const buyVip = params => post('api/user/equity/buyEquity', params) // 购买会员
export const buySubmit = params => post('api/user/equity/pay', params) // 支付
export const getVipOrder = () => get('api/user/equity/order') // 历史订单
export const getorderDelete = (id) => get(`api/user/equity/del/${id}`) // 删除历史订单

//个人中心-个人信息
export const getUserInfo = () => get("api/user/myinfo");
export const updateUserInfo = params => post("api/user/editmyinfo", params);
export const updatePwd = params => post("api/user/changepwd", params);
export const updateMobile = params => post("api/user/changephone", params);
export const updateEmail = params => post("api/user/changeemail", params);

// 获取邮箱验证码
export const getEmailCodeApi = data => post("api/auth/verifyEmail", data);

//个人中心-发票管理
export const getInvoice = params => get("api/invoice/lst", params);
export const addInvoice = params => post("api/invoice/add", params);
export const setDefInvoice = params => get("api/invoice/def/" + params);
export const delInvoice = params => get("api/invoice/del/" + params);
export const detailInvoice = params => get("api/invoice/det/" + params);
export const updateInvoice = params => post("api/invoice/edit", params);

//个人中心-地址管理
export const getAddress = params => get("api/user/address/lst", params);
export const addEditAddress = params => post("api/user/address/create", params);
export const setDefAddress = params => post("api/user/address/update/" + params);
export const delAddress = params => get("api/user/address/delete/" + params);
export const detailAddress = params => get("api/user/address/detail/" + params);

//个人中心-浏览历史
export const myHistory = params => get("api/user/history", params);

//个人中心-我的消息
export const myMessage = params => get("api/user/notice/lst", params); // 系统公告
export const messageOptions = params => get("api/user/setting/data", params);
export const messageOptionsSet = params => post("api/user/setting/set", params);
export const messageSystem = () => get("api/user/news_log/lst"); // 系统消息
export const messageBusiness = () => get("api/user/business/lst"); // 业务消息
export const systemMessageDetail = (id) => get('api/user/news_log/detail/' + id) /**系统消息详情 */

// 个人中心 - 支出管理
export const classTop = () => post("api/user/count/zhi/classtop");

//全部流水
export const userCountWholeList = params => post('api/user/count/whole', params)

// 个人中心 - 欢迎页
export const getCountLog = () => post("api/user/count/zhi/log");
export const getCountBase = () => post("api/user/count/base");

//首页-专题
export const getProSpecialCate = id => get(`api/system/special/material/category/lst/${id}`); // 分类 id, 0 服务 1 材料
export const getcategoryProduct = id => get(`api/system/special/material/category/product/${id}`); //todo

// 材料推荐商品
export const getProSpecialList = params => get("api/system/special/material/lst/" + params.id, params);

// 服务推荐商品
export const getSerSpecialList = params => get("api/system/special/service/lst/" + params.id, params);
export const getSpecialBanner = params => get("api/system/special/banner/lst/" + params);

// 材料推荐商家
export const getRecommendProList = () => get("api/system/special/material/merchant/0");

// 服务推荐商家
export const getRecommendSerList = () => get("api/system/special/material/merchant/1");

// 分享邮件
export const getEmailSet = params => post("api/email/send", params);

// Top商铺排行
export const getMerchantLog = () => get("api/user/count/merchant");
export const getProductLog = () => get("api/user/count/product");
export const getProList = () => get("api/user/count/pro_list"); // 产品详情排行
export const getMerList = () => get("api/user/count/mer_list"); // 商品详情排行
export const isHavePayCheck = params => post("api/l/order/pay_check", params); // 订单是否支付

// 实名认证
export const autonymapi = params => post("api/user/autonym", params);
// 平台规则
export const platformRules = (id) => get(`api/article/agreement/${id}`);
// 听听他们说
export const packmateSayApi = () => get('api/store/merchant/packmate/say')
// 发布需求-最新发布列表
export const demandRecentlyList = () => get("api/demand/recently")
// 我的委托详情-回复
export const demandAddContent = (params) => post("api/demand/add_content",params)
/** 我的供应商-详情 */
export const merchantDetailInfo = (params) => get(`api/user/count/mer_detail/${params.id}?page=${params.page}&limit=${params.limit}`)
